import DefaultTheme from 'vitepress/theme'
import ElementPlus from 'element-plus'
import '../styles/app.scss'

import 'element-plus/dist/index.css'
import 'element-plus/theme-chalk/dark/css-vars.css'
import locale from 'element-plus/lib/locale/lang/zh-cn'
// 图标并进行全局注册
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

import { useComponents } from './useComponents'

// 基于element-plus二次封装基础组件
import svmp from '@v-model/shared--modules'
// import svmp from '../../../shared/modules/dist/svmp.es.js'
// import svmps from 'svmp'
import '../../public/css/index.css'

export default {
  ...DefaultTheme,
  enhanceApp(ctx) {
    DefaultTheme.enhanceApp(ctx)
    // 注册ElementPlus
    useComponents(ctx.app)

    // document.documentElement.style.setProperty('--v-primary-backgroud-color', 'red')

    ctx.app.use(ElementPlus, {
      locale, // 语言设置
      size: 'small',
    })

    // 注册所有图标
    for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
      ctx.app.component(key, component)
    }

    // 全局注册基础组件
    ctx.app.use(svmp, { options: '22222222222222' })
  },
}
